from core.config import Config
from stock.stock_hist import StockHist
from stock.clear_datas import ClearDatas
from technicalindicator.indicators import Indicators
from server.server import Server

from model.db_operator import MarketFundOperator, FundOperator
import model.db_operator as dbOperator
import model.db_models as dbModel

#debug
import logging
import sys
import time
from datetime import date, datetime
import psycopg2
import akshare as ak
import pandas as pd
import numpy as np
import core.utils as utils
import sched

if __name__ == '__main__':

    utils.LogConfig()
    config = Config()


    # tmp test 1
    # stock_df = ak.stock_zh_a_spot_em()
    # stock_df.to_csv("./tmp/tmp_stock.csv")

    # RSI test 2
    # indicators = Indicators()
    # conn = psycopg2.connect(database="finance",
    #                         user="postgres", password="123456",
    #                         host="127.0.0.1", port="5432")
    # cur = conn.cursor()  # 创建指针对象
    # select_sql = '''SELECT id,date,open,close,hight,low FROM stock_datas.stock_qfq_000333 ORDER BY date DESC LIMIT 1000;'''
    # cur.execute(select_sql)
    # df = pd.DataFrame(cur.fetchall())
    # have, rsi10 = indicators.RSI(df, 4, 14, 30)
    # print(have, rsi10)

    # func()

    # server RSI
    server = Server(config)
    # server.GetOneStockRSI("000333", "hell", 35.0,  14, 1)
    server.GetOneStockKDJ("000333", "hell", 14, 3, 3)





